<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="footer.css" />
		<script src="../../js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../js/webuploader-0.1.5/webuploader.css" />
		<script src="../../js/webuploader-0.1.5/webuploader.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="../../css/lystyle.css" />
		<style type="text/css">
			/*修改底部字体颜色*/
			
			.foot:nth-child(4) {
				color: #e83023;
			}
			
			.vip_img {
				padding-bottom: 0.694444rem;
				box-shadow: 0.069444rem 0.069444rem 0.069444rem #b3b3b3;
			}
			
			.vip_img .vip_div {
				margin: 0 auto;
				position: relative;
				width: 2.152777rem;
				height: 2.152777rem;
				border-radius: 100%;
				overflow: hidden;
				background: #E9303E;
				margin-top: 0.777rem;
				z-index: 0;
			}
			
			.vip_img .vip_div img {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				z-index: 10;
			}
			
			.vip_img>a {
				width: 2rem;
				padding: 0.12rem 0.25rem;
				border: none;
			}
			
			.vip_img>p {
				margin-top: 0.236111rem;
				margin-left: 0.381rem;
			}
			
			.edit {
				width: 100%;
				height: 0.5777rem;
				line-height: 0.5777rem;
				font-size: 0.1388rem;
				text-align: center;
				background: rgba(132, 132, 132, 0.8);
				position: absolute;
				bottom: 0;
				left: 0;
				z-index: 10;
				color: white;
			}
			
			.edit input {
				width: 100%;
				height: 0.5777rem;
				position: absolute;
				bottom: 0;
				left: 0;
				z-index: 25;
				opacity: 0;
			}
			
			.add_btn {
				background: #E9303E;
			}
			
			.webuploader-pick {
				position: relative;
				display: inline-block;
				cursor: pointer;
				background: rgba(132, 132, 132, 0.8);
				padding: 0;
				color: #fff;
				text-align: center;
				border-radius: 3px;
				overflow: hidden;
				font-size: 15px;
			}
		</style>

		<script src="../qiniu/plupload-2.3.5/js/moxie.js" type="text/javascript"></script>
		<script src="../qiniu/plupload-2.3.5/js/plupload.dev.js" type="text/javascript"></script>
		<script src="../qiniu/dist/qiniu.js" type="text/javascript"></script>
		<script src="../qiniu/plupload-2.3.5/js/i18n/zh_CN.js" type="text/javascript"></script>

	</head>

	<body class="ly-bgcolor">
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../images/12.png" /></a>
					<!--<a id="headRightImage" href="#"><img class="headRightImg" src="../../images/personage/myinfo.png" /></a>-->
					<p id="headTitle">我的信息</p>
				</div>
				<div id="content" class="vip_img" style="padding-bottom: 1.319444rem;">
					<!--头像-->
					<!--<div class="ly-userimg">
						<img :src="list.avatar" v-if="list.avatar" />
						<img v-else src="../../images/coalltion/touxiang.png" />
					</div>-->
					<div class="vip_div">
						<img :src="'http://oxjfr3ifx.bkt.clouddn.com/'+list.avatar" id="img1" v-if="list.avatar" />
						<img v-else src="../../images/coalltion/touxiang.png" id="img1" />
						<!--进度条-->
						<div id="fsUploadProgress1">
							<span></span>
							<div style="margin-top: 0.12rem;"></div>
						</div>
						<div id="uploader" class="wu-example edit">
							<div id="thelist" class="uploader-list"></div>
							<div class="btns" id="container1">
								<div id="pickfiles1">编辑</div>
							</div>
						</div>
					</div>
				</div>

				<!--基本信息-->
				<div class="ly-info">
					<div>
						<span class="ly-info-title">基本信息</span>
						<a class="ly-info-btn" href="../../view/login/register/register.html" style="float: right;" v-else>修改个人信息</a>
					</div>
					<ul class="ly-info-ul">
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">用户名 ：<span id="username" v-text="list.loginName"></span></span>
							</a>
						</li>
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">手机号 ：<span id="phone" v-text="list.tel"></span></span>
							</a>
						</li>
						<!--<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">邮箱号 ：
										<span id="email" v-text="list.email"></span>
								</span>
							</a>
						</li>-->
					</ul>
				</div>
				<!--会员信息-->
				<div class="ly-info" style="margin-top: 0.3rem;">
					<div>
						<span class="ly-info-title">会员信息</span>
						<a class="ly-info-btn" href="person_MakerApplyVip.html" v-if="vipK.id=='f1'" style="float: right;">续费</a>
						<span v-else>
							<a class="ly-info-btn" href="person_MakerApplyVip.html" v-if="chuangK.id=='f2'" style="float: right;">续费</a>
							<a v-else class="ly-info-btn" href="person_MakerApplyVip.html" style="float: right;">
							<font id="shzyf">认证</font>
							</a>
						</span>
						
					</div>
					<ul class="ly-info-ul">
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">会员期限 ：<span v-if="vipK.id=='f1'">1年</span><span v-else><span v-if="chuangK.id=='f2'">1年</span> <span v-else id="vipyear">暂未申请</span></span></span>
							</a>
						</li>
						<!--	<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">会员费用 ：<span v-if="vipK.id=='f1'">￥199.00</span><span v-else id="vippay">暂未申请</span></span>
							</a>
						</li>-->
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span>会员到期时间： <span v-if="vipK.id=='f1'">{{vipK.qixian }}</span><span v-else><span v-if="chuangK.id=='f2'">{{chuangK.qixian }}</span><span style="color: #666;" id="startU" v-else>暂未申请</span></span> </span>
								<br />
								<!--<span style="padding-left:90px;" id="endU">暂未申请</span>-->
							</a>
						</li>
					</ul>
				</div>
				<div class="ly-info" style="margin-top: 0.2rem;">
					<div>
						<span class="ly-info-title">创客信息</span>
						<!--../../../backstage/home/backstage_pay.html-->
						<a class="ly-info-btn" href="person_MakerApplyfans.html" style="float: right;" v-if='chuangK.id=="f2"'>续费</a>
						<a class="ly-info-btn" href="person_MakerApplyfans.html" style="float: right;" v-else>
							<font id="shzyf1">认证</font>
						</a>
					</div>
					<ul class="ly-info-ul">
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span">创客年限 ：<span v-if='chuangK.id=="f2"'>1年</span><span v-else>暂未申请</span></span>
							</a>
						</li>
						<!--<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span" id="ckM">创客费用 ：<span v-if='chuangK.id=="f2"'>￥399.00</span><span id="ckML" v-else>
										暂未申请
									</span></span>

							</a>
						</li>-->
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span>创客到期时间：<span v-if='chuangK.id=="f2"'>{{chuangK.qixian}}</span> <span style="color: #666;" id="startC" v-else>暂未申请</span></span>
								<br />
								<!--<span style="padding-left:90px;" id="endC">暂未申请</span>-->
							</a>
						</li>
					</ul>
				</div>
				<!--我的资产-->
				<div class="ly-info" style="margin-top: 0.2rem;">
					<div>
						<span class="ly-info-title">我的资产</span>
					</div>
					<ul class="ly-info-ul">
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span" id="rhNum">仁和币 ：</span><img class="headRightImg" src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span" id="goldNum">金币 ：</span>
							</a>
						</li>
						<li class="ly-info-li" style="border-bottom-width: 0px;">
							<a>
								<span class="ly-info-span" id="jf">积分 ：</span>
							</a>
						</li>
					</ul>
				</div>

			</div>
		</div>
		<div id="foot" class="row">
			<a class="foot col-xs-3 col-sm-3" href="../kaoqin/index2.html">
				<img class="footImg" src="../../images/15.png" />
				<p>管理</p>
			</a>
			<a class="foot col-xs-3 col-sm-3" href="../coalition/colalition.html">
				<img class="footImg" src="../../images/lianmengchushi.png" />
				<p>联盟</p>
			</a>
			<a class="foot col-xs-3 col-sm-3" href="../store/store.html">
				<img class="footImg" src="../../images/11.png" />
				<p>商城</p>
			</a>
			<a class="foot col-xs-3 col-sm-3" href="personIndex.html">
				<img class="footImg" src="../../images/myCheck.png" />
				<p>我的</p>
			</a>
		</div>

	</body>
	<script src="../../js/jquery-2.2.3.min.js"></script>
	<!--cookie 操作插件-->
	<script src="../../js/jquery.cookie.js"></script>
	<script src="../../../common/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="../../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/vue-resource.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var tokenReztApp = $.cookie("tokenReztApp");
		if(!tokenReztApp) {
			window.location.href = "../login/login/login.html";
		}
		//获取当前会员信息
		var user = '';

		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/current?token=" + tokenReztApp,
				dataType: "JSON",
				async: true,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					$.removeCookie('tokenReztApp', {
						expires: 7,
						path: '/'
					});
					$.removeCookie("tokenRh", {
						expires: 7,
						path: '/'
					});
					$.removeCookie('memberId', {
						expires: 7,
						path: '/'
					});
					$.removeCookie('roleId', {
						expires: 7,
						path: '/'
					});
					window.location.href = "../login/login/login.html";
				},
				success: function(data) {
					/*if(data.roleList[0].id != "f2") {
						window.location.href = "../../app/view/login/login/login.html";
					}*/
					user = data.loginName;
					roles = data.roleList; //角色集合
					goodsId = data.id;

				}
			});
		}
		$(function() {
			currentyf();
			/*	founder();
				founder2();*/
		});

		//查询当前用户创客审核状态 
		function founder() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109:80/applyfor-service/founder/searchUserType?applyforUser=" + user + "&type=1",
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {},
				success: function(data) {
					console.log(data.auditStatus);
					if(data != null && data.payStatus == "1" && data.auditStatus == "0") {
						$("#shzyf1").html("审核中");
						$("#shzyf1").parent().attr('href', 'javascript:void(0)');
					}
				}
			});
		}

		//查询当前用户会员审核状态 
		function founder2() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109:80/applyfor-service/founder/searchUserType?applyforUser=" + user + "&type=0",
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {},
				success: function(data) {
					console.log(data.auditStatus);
					if(data != null && data.payStatus == "1" && data.auditStatus == "0") {
						$("#shzyf").html("审核中");
						$("#shzyf").parent().attr('href', 'javascript:void(0)');
					}
				}
			});
		}
		var local = 'http://47.104.13.109/';
		//时间戳转化
		function fmtDate(obj) {
			var date = new Date(obj);
			var y = 1900 + date.getYear();
			var m = "0" + (date.getMonth() + 1);
			var d = "0" + date.getDate();
			return y + "/" + m.substring(m.length - 2, m.length) + "/" + d.substring(d.length - 2, d.length);
		}
		//		//第一张
		//		var uploader = WebUploader.create({
		//			auto: true, //true，选择文件后立即上传，false，选择文件后先进入文件队列
		//			// swf文件路径
		//			swf: 'webuploader-0.1.5/Uploader.swf',
		//			// 文件接收服务端。
		//			server: 'http://47.104.13.109/attachment-service/tfAttachment',
		//			// 选择文件的按钮。可选。
		//			// 内部根据当前运行是创建，可能是input元素，也可能是flash.
		//			pick: '#picker',
		//			compress: {
		//				width: 1080,
		//				height: 500,
		//				// 图片质量，只有type为`image/jpeg`的时候才有效。
		//				quality: 90,
		//				allowMagnify: false,
		//				// 是否允许裁剪。
		//				crop: true,
		//				// 是否保留头部meta信息。
		//				preserveHeaders: true,
		//				// 此属性可能会影响图片自动纠正功能
		//				noCompressIfLarger: false,
		//				// 单位字节，如果图片大小小于此值，不会采用压缩。
		//				compressSize: 1,
		//				sendAsBinary: true
		//			},
		//			// 不压缩image, 默认如果是jpeg，文件上传前会压缩一次再上传！
		//
		//			fileSingleSizeLimit: 2 * 1024 * 1024,
		//			accept: {
		//				/* title : 'jpg,jpeg,png',
		//				extensions : 'jpg,jpeg,png',
		//				mimeTypes : 'image/jpeg,image/png' */
		//				title: 'Images',
		//				extensions: 'jpg,jpeg,bmp,png',
		//				mimeTypes: 'image/jpeg,image/bmp,image/png'
		//			},
		//			duplicate: true,
		//		});
		//		uploader.on('error', function(type) {
		//			alert("图片过大，请按要求大小上传图片");
		//		});
		//				uploader.on('uploadSuccess', function(file, response) {
		//					//根据file和response做数据处理，保存到数据库，返回处理信息
		//					var s = response._raw;
		//					console.log(response);
		//					var pic1 = "http://oxjfr3ifx.bkt.clouddn.com/" + s;
		//					$("#img1").attr("src", pic1);
		//					$("#img1").show();
		//					//上传图片 更改个人信息
		//					$.ajax({
		//						type: "get",
		//						url: local + 'member-service/member/mine/member?token=' + $.cookie('tokenRh'),
		//						async: true,
		//						success: function(res) {
		//							console.log(res);
		//							var birthday = fmtDate(res.birthday);
		//							if(birthday == '') {
		//								birthday = "1900/01/01"
		//							} else {
		//								birthday = fmtDate(res.birthday);
		//							}
		//							$.ajax({
		//								type: "post",
		//								url: "http://47.104.13.109/member-service/member/mine/member",
		//								async: true,
		//								data: {
		//									'token': $.cookie('tokenRh'),
		//									'avatar': s,
		//									'gender': res.gender || 1,
		//									'birthday': birthday,
		//									'industry': res.industry || "IT",
		//									'profession': res.profession || "程序媛",
		//									'hobby': res.hobby || "敲代码",
		//									'address': res.address || "火星"
		//								},
		//								success: function(res) {
		//									console.log(res);
		//									console.log(pic1)
		//									$("#img1").attr("src", pic1);
		//		
		//								},
		//								error: function(res) {
		//									console.log(res);
		//								}
		//							});
		//						},
		//						error: function(res) {
		//							console.log(res);
		//						}
		//					});
		//		
		//				});
		var uploader1 = Qiniu.uploader({
			runtimes: 'html5,flash,html4', // 上传模式，依次退化
			browse_button: 'pickfiles1', // 上传选择的点选按钮，必需			
			uptoken_func: function() { // 在需要获取uptoken时，该方法会被调用
				var res;
				$.ajax({
					cache: false,
					type: "GET",
					url: "http://47.104.13.109/attachment-service/getToken",
					dataType: "text",
					async: false,
					error: function(XMLHttpRequest, textStatus, errorThrown) {},
					success: function(data) {
						res = data;
					}
				});
				return res;
			},
			get_new_uptoken: false, // 设置上传文件的时候是否每次都重新获取新的uptoken
			unique_names: true, // 默认false，key为文件名。若开启该选项，JS-SDK会为每个文件自动生成key（文件名）			
			domain: 'wjx9701', // bucket域名，下载资源时用到，必需
			container: 'container1', // 上传区域DOM ID，默认是browser_button的父元素
			max_file_size: '8mb', // 最大文件体积限制
			max_retries: 1, // 上传失败最大重试次数
			dragdrop: false, // 开启可拖曳上传
			chunk_size: '4mb', // 分块上传时，每块的体积
			auto_start: true, // 选择文件后自动上传，若关闭需要自己绑定事件触发上传		
			init: {
				'FilesAdded': function(up, files) {
					plupload.each(files, function(file) {
						// 文件添加进队列后，处理相关的事情
					});
				},
				'BeforeUpload': function(up, file) {
					// 每个文件上传前，处理相关的事情
				},
				'UploadProgress': function(up, file) {
					// 每个文件上传时，处理相关的事情
					//					$("#fsUploadProgress1").css('display', 'block');
					var percent = file.percent;
					//					$("#fsUploadProgress1").find("span").css({
					//						"width": percent + "%"
					//					});
					$("#pickfiles1").text(percent + "%");
					if(percent == "100") {
						$("#pickfiles1").text("编辑");
					}
				},
				'FileUploaded': function(up, file, info) {
					// 每个文件上传成功后，处理相关的事情
					// 其中info.response是文件上传成功后，服务端返回的json，形式如：
					var res = JSON.parse(info.response);
					var s = res.key;
					var pic1 = "http://oxjfr3ifx.bkt.clouddn.com/" + s;
					//					$("#zl1").val(res.key);
					$("#img1").attr("src", "http://oxjfr3ifx.bkt.clouddn.com/" + res.key);
					$("#img1").show();
					//上传图片 更改个人信息
					$.ajax({
						type: "get",
						url: local + 'member-service/member/mine/member?token=' + $.cookie('tokenRh'),
						async: true,
						success: function(res) {
							console.log(res);
							var birthday = fmtDate(res.birthday);
							if(birthday == '') {
								birthday = "1900/01/01"
							} else {
								birthday = fmtDate(res.birthday);
							}
							$.ajax({
								type: "post",
								url: "http://47.104.13.109/member-service/member/mine/member",
								async: true,
								data: {
									'token': $.cookie('tokenRh'),
									'avatar': s,
									'gender': res.gender || 1,
									'birthday': birthday,
									'industry': res.industry || "",
									'profession': res.profession || "",
									'hobby': res.hobby || "",
									'address': res.address || ""
								},
								success: function(res) {
									console.log(res);
									console.log(pic1)
									$("#img1").attr("src", pic1);

								},
								error: function(res) {
									console.log(res);
								}
							});
						},
						error: function(res) {
							console.log(res);
						}
					});

				},
				'Error': function(up, err, errTip) {
					//上传出错时，处理相关的事情
				},
				'UploadComplete': function() {
					//队列文件处理完毕后，处理相关的事情
				},
				'Key': function(up, file) {
					// 若想在前端对每个文件的key进行个性化处理，可以配置该函数
					// 该配置必须要在unique_names: false，save_key: false时才生效
					var key = "";
					return key
				}
			}
		});
		new Vue({
			el: '#wrap',
			data: {
				list: {},
				loginName: '',
				chuangK: {},
				vipK: {},
				user: {},
				memberIds: '',
			},
			created: function() {
				var that = this;
				that.$http({
					//+ $.cookie('tokenRh')
					url: local + 'member-service/member/mine/member?token=' + $.cookie('tokenRh'),
					method: 'GET'
				}).then(function(res) {
					console.log(res.data)
					that.list = res.data;
					that.tel = res.data.tel || ''; //创客信息 创客1
					that.memberIds = res.data.id;
					for(var i = 0; i < res.data.roleList.length; i++) {
						if(res.data.roleList[i].id == 'f1') {
							this.vipK = res.data.roleList[i];
							this.vipK.qixian = fmtDate(this.vipK.deadline);
						} else if(res.data.roleList[i].id == 'f2') {
							this.chuangK = res.data.roleList[i];
							this.chuangK.qixian = fmtDate(this.chuangK.deadline);
						}
					}
					console.log(this.vipK);
					that.$http({
							url: local + 'applyfor-service/founder/search?pageNum=1&pageSize=1&applyforType=1&applyforUser=' + that.tel,
							method: 'GET'
						}).then(function(res) {
							console.log(res.data);
							if(res.data.code == 1) {
								that.chuangK = res.data.applyform;
								$("#ckML").text(res.data.applyform.membercost || '');
								$("#startC").text(that.chuangK.applyforDate || '');
								$("#endC").text(that.chuangK.dueDate);
								founder();
								founder2();
							}
						})
						//会员信息 会员0
					that.$http({
							url: local + 'applyfor-service/founder/search?pageNum=1&pageSize=1&applyforType=0&applyforUser=' + that.tel,
							method: 'GET'
						}).then(function(res) {
							console.log(res.data)
							if(res.data.code == 1) {
								that.user = res.data.applyform;
								$("#vippay").text(res.data.applyform.membercost);
								$("#startU").text(that.chuangK.applyforDate);
								$("#endU").text(that.chuangK.dueDate);
								founder();
								founder2();
							}
						})
						//我的资产
					that.$http({
							url: local + 'gold-service/tfGoldList?memberIds=' + that.memberIds,
							method: 'post'
						}).then(function(res) {
							console.log(res.data);
							var goldNum = res.data[0].goldNum
							if(goldNum == null) {
								goldNum = ''
							}
							$("#goldNum").text("金币: " + goldNum);
							//goldNum
							founder();
							founder2();
						})
						//仁和币
					that.$http({
							url: local + 'coin-service/coin/search2?rhObject=' + that.memberIds,
							method: 'post'
						}).then(function(res) {
							console.log(res.data);
							var rhNum = res.data;
							$("#rhNum").text("仁和币: " + rhNum);
							//goldNum
							founder();
							founder2();
						})
						//积分
					that.$http({
						url: local + 'integral-service/tfIntegral/' + that.memberIds,
						method: 'GET'
					}).then(function(res) {
						console.log(res.body.integralNum);
						var integral = res.body.integralNum
						if(integral == null) {
							integral = ''
						}
						$("#jf").text("积分: " + integral);
						//goldNum
						founder();
						founder2();
					})
				});
			}
		})
	</script>

</html>